﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;

namespace HigLabo.Net.Twitter
{
    public partial class TwitterClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="callback"></param>
        public void GetFavorites(Int64 userid, Action<StatusCollection> callback)
        {
            var cm = new GetFavoritesCommand();
            cm.UserID = userid;
            this.GetFavorites(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="screenName"></param>
        /// <param name="callback"></param>
        public void GetFavorites(String screenName, Action<StatusCollection> callback)
        {
            var cm = new GetFavoritesCommand();
            cm.ScreenName = screenName;
            this.GetFavorites(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetFavorites(GetFavoritesCommand command, Action<StatusCollection> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Favorites.GetFavoritesUrl, command, json => callback(new StatusCollection(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="includeEntities"></param>
        /// <param name="callback"></param>
        public void CreateFavorites(Int64 id, Boolean includeEntities, Action<Status> callback)
        {
            var cm = new CreateFavoritesCommand();
            cm.ID = id;
            cm.IncludeEntities = includeEntities;
            this.CreateFavorites(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void CreateFavorites(CreateFavoritesCommand command, Action<Status> callback)
        {
            this.GetResultText(HttpMethodName.Post, TwitterApiUrl.Version1_1.Favorites.CreateFavoritesUrl, command, json => callback(new Status(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="includeEntities"></param>
        /// <param name="callback"></param>
        public void DestroyFavorites(Int64 id, Boolean includeEntities, Action<Status> callback)
        {
            var cm = new DestroyFavoritesCommand();
            cm.ID = id;
            cm.IncludeEntities = includeEntities;
            this.DestroyFavorites(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void DestroyFavorites(DestroyFavoritesCommand command, Action<Status> callback)
        {
            this.GetResultText(HttpMethodName.Post, TwitterApiUrl.Version1_1.Favorites.DestroyFavoritesUrl, command, json => callback(new Status(json)));
        }
    }
}
